package ar.uba.dc.webming.tp1.relevance;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.List;
import java.util.Vector;

public class RelevanceParser {
    
    public List<RelevanceJudgment> parse(InputStreamReader isr) throws IOException{
        List<RelevanceJudgment> result = new Vector<RelevanceJudgment>();
        BufferedReader br = new BufferedReader(isr);
        String line = "";
        while (( line = br.readLine()) != null){
            result.add(parseLine(line));
        }
        return result;
    }

    private RelevanceJudgment parseLine(String line) {
        String[] splitedLine = line.split("\t");
        return new RelevanceJudgment(splitedLine[0], splitedLine[1], Integer.valueOf(splitedLine[2]));
    }

}
